
<!DOCTYPE html>
<html lang="en">
    <head><meta name="generator" content="Hexo 3.9.0">
        <title>Guide - Vue Carousel 3D - 3D Carousel for Vue.js</title>
        <meta charset="utf-8">
        <meta name="description" content="Vue Carousel 3D - Beautiful, flexible and touch supported 3D Carousel for Vue.js">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

        <meta property="og:type" content="article">
        <meta property="og:title" content="Guide - Vue Carousel 3D">
        <meta property="og:description" content="Vue Carousel 3D - Beautiful, flexible and touch supported 3D Carousel for Vue.js">
        <meta property="og:image" content="https:///images/logo.png">

        <meta name="twitter:card" content="summary">
        <meta name="twitter:title" content="Guide - Vue Carousel 3D">
        <meta name="twitter:description" content="Vue Carousel 3D - Beautiful, flexible and touch supported 3D Carousel for Vue.js">
        <meta name="twitter:image" content="https:///images/logo.png">

        <meta name="google-site-verification" content="j7k2Vin9D3fJKlxZqkcEQK-o4eH3yJbJHwi3u2-KHwQ">

        <link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600|Roboto Mono" rel="stylesheet" type="text/css">
        <link href="//fonts.googleapis.com/css?family=Dosis:500&text=Vue.js" rel="stylesheet" type="text/css">

        <!-- main page styles -->
        <link rel="stylesheet" href="/vue-carousel-3d/css/page.css">

        <!-- this needs to be loaded before guide's inline scripts -->
        <script src="/vue-carousel-3d/js/vue.js"></script>
        <script src="/vue-carousel-3d/js/carousel-3d.umd.js"></script>
        <script>window.PAGE_TYPE = ""</script>
    </head>
    <body class="docs">        <div id="mobile-bar">
            <a class="menu-button"></a>
            <a class="logo" href="/vue-carousel-3d/"></a>
        </div>
        <div id="header">
  <a id="logo" href="/vue-carousel-3d/">
    <img src="/vue-carousel-3d/images/logo.png" alt="Vue Carousel 3D">
    <span>Vue Carousel 3D</span>
  </a>
  <ul id="nav">
    <li><a href="/vue-carousel-3d/guide" class="nav-link current">Guide</a></li>
<li><a href="/vue-carousel-3d/api" class="nav-link">API</a></li>
<li><a href="/vue-carousel-3d/examples" class="nav-link">Examples</a></li>
<li><a href="/vue-carousel-3d/playground" class="nav-link">Playground</a></li>

  </ul>
</div>

        
            <div id="main" class="fix-sidebar">
                
                    
<div class="sidebar">
    <ul class="main-menu">
        <li><a href="/vue-carousel-3d/guide" class="nav-link current">Guide</a></li>
<li><a href="/vue-carousel-3d/api" class="nav-link">API</a></li>
<li><a href="/vue-carousel-3d/examples" class="nav-link">Examples</a></li>
<li><a href="/vue-carousel-3d/playground" class="nav-link">Playground</a></li>

    </ul>
</div>

<div class="content  ">
    
      <h1>Guide</h1>
    
    <h2 id="Installation"><a href="#Installation" class="headerlink" title="Installation"></a>Installation</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -S vue-carousel-3d</span><br></pre></td></tr></table></figure>
<h2 id="Usage-Global"><a href="#Usage-Global" class="headerlink" title="Usage (Global)"></a>Usage (Global)</h2><p>You may install Vue Carousel 3d globally:</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> Vue <span class="keyword">from</span> <span class="string">'vue'</span>;</span><br><span class="line"><span class="keyword">import</span> Carousel3d <span class="keyword">from</span> <span class="string">'vue-carousel-3d'</span>;</span><br><span class="line"></span><br><span class="line">Vue.use(Carousel3d);</span><br></pre></td></tr></table></figure>
<p>This will make <strong>&lt;carousel&gt;</strong> and <strong>&lt;slide&gt;</strong> available to all components within your Vue app.</p>
<h2 id="Usage-Local"><a href="#Usage-Local" class="headerlink" title="Usage (Local)"></a>Usage (Local)</h2><p>Include the carousel 3d into your component using import:</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> &#123; Carousel3d, Slide &#125; <span class="keyword">from</span> <span class="string">'vue-carousel-3d'</span>;</span><br><span class="line"></span><br><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> &#123;</span><br><span class="line">  ...</span><br><span class="line">  components: &#123;</span><br><span class="line">    Carousel3d,</span><br><span class="line">    Slide</span><br><span class="line">  &#125;</span><br><span class="line">  ...</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
<h2 id="HTML-Structure"><a href="#HTML-Structure" class="headerlink" title="HTML Structure"></a>HTML Structure</h2><p>Once the <strong>Carousel3d</strong> and <strong>Slide</strong> components are installed globally or imported, they can be used in templates like below:</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">carousel-3d</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">slide</span> <span class="attr">:index</span>=<span class="string">"0"</span>&gt;</span></span><br><span class="line">    Slide 1 Content</span><br><span class="line">  <span class="tag">&lt;/<span class="name">slide</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">slide</span> <span class="attr">:index</span>=<span class="string">"1"</span>&gt;</span></span><br><span class="line">    Slide 2 Content</span><br><span class="line">  <span class="tag">&lt;/<span class="name">slide</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">carousel-3d</span>&gt;</span></span><br></pre></td></tr></table></figure>
<p>Keep in mind that <strong>index</strong> property on slide component is required property and you will need to pass it for every slide starting from 0 </p>
<h2 id="Scoped-Slots"><a href="#Scoped-Slots" class="headerlink" title="Scoped Slots"></a>Scoped Slots</h2><p>You can use scoped slots to access current slide index, left and right indexes</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">carousel-3d</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">slide</span> <span class="attr">v-for</span>=<span class="string">"(slide, i) in slides"</span> <span class="attr">:index</span>=<span class="string">"i"</span> <span class="attr">:key</span>=<span class="string">"i"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">template</span> <span class="attr">slot-scope</span>=<span class="string">"&#123; index, isCurrent, leftIndex, rightIndex &#125;"</span>&gt;</span></span><br><span class="line">            <span class="tag">&lt;<span class="name">img</span> <span class="attr">:data-index</span>=<span class="string">"index"</span> <span class="attr">:class</span>=<span class="string">"&#123; current: isCurrent, onLeft: (leftIndex &gt;= 0), onRight: (rightIndex &gt;= 0) &#125;"</span> <span class="attr">:src</span>=<span class="string">"slide.src"</span>&gt;</span></span><br><span class="line">        <span class="tag">&lt;/<span class="name">template</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;/<span class="name">slide</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">carousel-3d</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h2 id="Development"><a href="#Development" class="headerlink" title="Development"></a>Development</h2><p>Dev environment is created by <a href="https://github.com/vue-play/vue-play" target="_blank" rel="noopener">vue-play</a>. Changes made to the component files will appear in real time in the sandbox.</p>
<p>To begin development, run:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">npm install</span><br><span class="line">npm run dev</span><br></pre></td></tr></table></figure>
<p>now open <code>http://localhost:5000</code> in your browser</p>
<p>You can modify and add scenarios in <code>play/index.js</code></p>
<h2 id="License"><a href="#License" class="headerlink" title="License"></a>License</h2><p>This project is licensed under the MIT License - see the <a href="LICENSE.md">LICENSE.md</a> file for details.</p>

    
    <div class="footer">
      Caught a mistake or want to contribute to the documentation?
      <a href="https://github.com/Wlada/vue-carousel-3d/blob/master/docs/source/guide/index.md" target="_blank">
        Edit this page on Github!
      </a>
    </div>
</div>

                
            </div>
            <script src="/vue-carousel-3d/js/smooth-scroll.min.js"></script>
        

        <!-- main custom script for sidebars, version selects etc. -->
        <script src="/vue-carousel-3d/js/common.js"></script>

        <!-- ga -->
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          ga('create', 'UA-4467381-14', 'auto');
          ga('send', 'pageview');
        </script>

        <!-- search -->
        <link href="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" rel="stylesheet" type="text/css">
        <link rel="stylesheet" href="/vue-carousel-3d/css/search.css">
        <script src="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
        <script>
            [
                '#search-query-nav',
                '#search-query-sidebar'
            ].forEach(function (selector) {
                if (!document.querySelector(selector)) return
                // search index defaults to v2
                var match = window.location.pathname.match(/^\/(v\d+)/)
                var version = match ? match[1] : 'v2'
//                docsearch({
//                    appId: 'BH4D9OD16A',
//                    apiKey: '85cc3221c9f23bfbaa4e3913dd7625ea',
//                    indexName: 'vuejs',
//                    inputSelector: selector,
//                    algoliaOptions: { facetFilters: ["version:" + version] }
//                })
            })
        </script>

        <!-- fastclick -->
        <script src="//cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js"></script>
        <script>
        document.addEventListener('DOMContentLoaded', function() {
          FastClick.attach(document.body)
        }, false)
        </script>
    </body>
</html>
